//
//  YSY_HeroRelation_TableViewCell.m
//  GoodManNews
//
//  Created by dllo on 16/1/14.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "YSY_HeroRelation_TableViewCell.h"

@implementation YSY_HeroRelation_TableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)dealloc
{
    [_headImageV release];
    [_heroIntroduceL release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return  self;
}

- (void)createView {
    self.headImageV = [UIImageView new];
    [self.contentView addSubview:self.headImageV];
    
    self.heroIntroduceL = [UILabel new];
    self.heroIntroduceL.numberOfLines = 0;
    [self.contentView addSubview:self.heroIntroduceL];

    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    [self.headImageV  mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.left.equalTo(self.contentView).with.offset(PAD);
        make.width.mas_equalTo((self.contentView.bounds.size.width - 2 * PAD) / 3);
        make.height.mas_equalTo((self.contentView.bounds.size.width - 2 * PAD) / 3);
    }];
    self.heroIntroduceL.frame = CGRectMake(self.headImageV.frame.origin.x + self.headImageV.bounds.size.width, PAD, (self.contentView.bounds.size.width - 2 * PAD) / 3 * 2 , self.contentView.bounds.size.height - PAD);
}

+ (CGFloat)stringHeight:(NSString *)str width:(CGFloat)width{
    CGRect frame = [str boundingRectWithSize:CGSizeMake(width, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:20] forKey:NSFontAttributeName] context:nil];
    
    return frame.size.height;
}
@end
